﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core;
using Cofe.Core.Dynamic;
using Cofe.Core.Implements;
using Cofe.Core.Property;

namespace Cofe.Media
{
    public class ImageInfo : MediaInfo, IImageInfo
    {
        #region Constructor

        void init(IPropertyHost properties)
        {
            
        }


        public ImageInfo(IPropertyHost properties, IDynamicPropertyInterfaceProvider[] providers)
            : base(properties, providers)
        {
            init(properties);
        }

        public ImageInfo(IPropertyHost properties)
            : base(properties)
        {
            init(properties);
        }

        protected ImageInfo()
            : base()
        {

        }

        #endregion

        #region Methods

        //public Task<StreamContainer> OpenReadAsync()
        //{
        //    return Properties.Behaviors.InvokeAsync<StreamContainer>(CofeStreamProperties.OpenReadAsync);
        //}

        //public Task<StreamContainer> OpenWriteAsync()
        //{
        //    return Properties.Behaviors.InvokeAsync<StreamContainer>(CofeStreamProperties.OpenWriteAsync);
        //}

        #endregion

        #region Data

        #endregion

        #region Public Properties

        public override string Type
        {
            get { return MediaTypes.Image; }
            protected set { base.Type = value; }
        }

        public string CameraModel
        {
            get { return Properties.Behaviors.TryGetProperty<string>(ExifProperties.CameraModel); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.CameraModel, value); }
        }

        public string CameraMaker
        {
            get { return Properties.Behaviors.TryGetProperty<string>(ExifProperties.CameraMaker); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.CameraMaker, value); }
        }

        public Int16 Orientation
        {
            get { return Properties.Behaviors.TryGetProperty<Int16>(ExifProperties.Orientation); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.Orientation, value); }
        }

        public float Aperture
        {
            get { return Properties.Behaviors.TryGetProperty<float>(ExifProperties.Aperture); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.Aperture, value); }
        }

        public Int32 FNumber
        {
            get { return Properties.Behaviors.TryGetProperty<Int32>(ExifProperties.FNumber); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.FNumber, value); }
        }

        public int ExposureTime
        {
            get { return Properties.Behaviors.TryGetProperty<Int32>(ExifProperties.ExposureTime); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.ExposureTime, value); }
        }

        public Int16 ISO
        {
            get { return Properties.Behaviors.TryGetProperty<Int16>(ExifProperties.ISO); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.ISO, value); }
        }

        public Int32 FocalLength
        {
            get { return Properties.Behaviors.TryGetProperty<Int32>(ExifProperties.FocalLength); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.FocalLength, value); }
        }

        public Int16 Flash
        {
            get { return Properties.Behaviors.TryGetProperty<Int16>(ExifProperties.Flash); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.Flash, value); }
        }

        public DateTime DateTime
        {
            get { return Properties.Behaviors.TryGetProperty<DateTime>(ExifProperties.DateTime); }
            protected set { Properties.Behaviors.SetProperty(ExifProperties.DateTime, value); }
        }

        #endregion




       

      

    }
}
